package com.its.cloud.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * @author huguangjun
 * @className AccountMapper
 * @date 2021/1/18
 * @desc 11:10
 */
@Mapper
public interface AccountMapper {

    /**
     * 账户扣钱
     *
     * @param userId
     * @param money
     */
    @Update("update t_account set residue = residue - #{money},used = used + #{money} where user_id =#{userId}")
    void decrease(@Param("userId") Long userId, @Param("money") BigDecimal money);
}
